/*
 * @Author: xiaosihan 
 * @Date: 2021-07-11 22:32:31 
 * @Last Modified by: xiaosihan
 * @Last Modified time: 2021-07-17 23:29:00
 */
//
// 重构的  直角坐标系
import * as THREE from "three";
import Object3D from "../Object3D/Object3D";
import Object3DComponent, { Object3DComponentProps } from "../Object3D/Object3DComponent";

export interface GridHelperProps extends Object3DComponentProps {
}

interface State {
}

export default class GridHelper extends Object3DComponent<GridHelperProps, State> {

    constructor(props: GridHelperProps) {
        super(props);

        this.object3d = new THREE.GridHelper(200, 20, 0x404040, 0x404040) as THREE.GridHelper & Object3D;
    }

    static defaultProps = {
        position: { x: 0, y: 0, z: 0 },
        visible: true,
        clipping: false
    }

    setGridHelperParam() {
        const { dev } = this.context;

        this.object3d.visible = dev;
    }

    componentDidMount() {
        this.setGridHelperParam();
    }

    componentDidUpdate() {
        this.setGridHelperParam();
    }

    render() {
        return null;
    }

}